<?php echo $header; ?>
<div id="content">
  <div class="breadcrumb">
    <?php foreach ($breadcrumbs as $breadcrumb) { ?>
    <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
    <?php } ?>
  </div>
  <?php if ($error_warning) { ?>
  <div class="warning"><?php echo $error_warning; ?></div>
  <?php } ?>
  <?php if ($success) { ?>
  <div class="success"><?php echo $success; ?></div>
  <?php } ?>
  <div class="box">
    <div class="heading">
      <h1><img src="view/image/banner.png" alt="" /> <?php echo $heading_title; ?></h1>
      <div class="buttons"><a onclick="location = '<?php echo $insert; ?>'" class="button"><?php echo $button_insert; ?></a></div>
    </div>
    <div class="content">
      <form action="" method="post" enctype="multipart/form-data" id="form">
        <table class="list">
          <thead>
            <tr>
              <td class="left"><?php echo $column_name; ?></td>
              <td class="left"><?php echo $column_position_type; ?></td>
              <td class="left"><?php echo $column_position_name; ?></td>
              <td class="left"><?php echo $column_status; ?></td>
              <td class="right"><?php echo $column_action; ?></td>
            </tr>
          </thead>
          <tbody>
            <tr class="filter">
              <td class="left"><input type="text" name="filter_name" value="<?php echo $filter_name; ?>" /></td>
              <td class="left">
                <input type="radio" name="filter_position_type" value="-1" <?php if ($filter_position_type == -1){ echo 'checked="checked"';} ?> /><?php echo $text_all; ?>
                <input type="radio" name="filter_position_type" value="0" <?php if ($filter_position_type == 0){ echo 'checked="checked"';} ?> /><?php echo $text_home; ?>
              	<input type="radio" name="filter_position_type" value="1" <?php if ($filter_position_type == 1){ echo 'checked="checked"';} ?> /><?php echo $text_type_category; ?>
              	<input type="radio" name="filter_position_type" value="2" <?php if ($filter_position_type == 2){ echo 'checked="checked"';} ?> /><?php echo $text_type_promotion; ?>
              </td>
              <td class="left"><input type="text" name="filter_position_name" value="<?php echo $filter_position_name; ?>" /></td>
              <td class="left">
                <input type="radio" name="filter_status" value="-1" <?php if ($filter_status == -1){ echo 'checked="checked"';} ?> /><?php echo $text_all; ?>
                <input type="radio" name="filter_status" value="0" <?php if ($filter_status == 0){ echo 'checked="checked"';} ?> /><?php echo $text_disabled; ?>
              	<input type="radio" name="filter_status" value="1" <?php if ($filter_status == 1){ echo 'checked="checked"';} ?> /><?php echo $text_enabled; ?>
              </td>
              <td align="right"><a onclick="filter();" class="button"><?php echo $button_filter; ?></a></td>
            </tr>
            <?php if ($banners) { ?>
            <?php foreach ($banners as $banner) { ?>
            <tr>
              <td class="left"><?php echo $banner['name']; ?></td>
              <td class="left"><?php echo $banner['position_type']; ?></td>
              <td class="left"><?php echo $banner['position_name']; ?></td>
              <td class="left"><?php echo $banner['status']; ?></td>
              <td class="right"><?php foreach ($banner['action'] as $action) { ?>
                [ <a href="<?php echo $action['href']; ?>"><?php echo $action['text']; ?></a> ]
                <?php } ?></td>
            </tr>
            <?php } ?>
            <?php } else { ?>
            <tr>
              <td class="center" colspan="5"><?php echo $text_no_results; ?></td>
            </tr>
            <?php } ?>
          </tbody>
        </table>
        <div class="pagination"><?php echo $pagination; ?></div>
      </form>
    </div>
  </div>
</div>
<script type="text/javascript"><!--
function filter() {
	url = 'index.php?route=design/banner&token=<?php echo $token; ?>';
	var filter_name = $('input[name=\'filter_name\']').attr('value');
	if (filter_name) {
		url += '&filter_name=' + encodeURIComponent(filter_name);
	}
	var filter_position_type = $('input[name=\'filter_position_type\']:checked').attr('value');
	if (filter_position_type != -1) {
		url += '&filter_position_type=' + encodeURIComponent(filter_position_type);
	}
	var filter_status = $('input[name=\'filter_status\']:checked').attr('value');
	if (filter_status != -1) {
		url += '&filter_status=' + encodeURIComponent(filter_status);
	}
	var filter_position_name = $('input[name=\'filter_position_name\']').attr('value');
	if (filter_position_name) {
		url += '&filter_position_name=' + encodeURIComponent(filter_position_name);
	}
	location = url;
}
//--></script>
<?php echo $footer; ?>